#include <buola/buola.h>

#ifdef BUOLA_HAVE_KINECT

#include <buola/cv/io/ckinect.h>

#include "ckinectdriver.h"

namespace buola { namespace cvi {

CKinect::CKinect()
    :   mDevice(get_kinect_driver().Device(0))
    ,   mStarted(false)
{
    mDevice->sImages.Connect(sImages);
    mCameraParameters.SetMatrix(CPoint_d(525,525),CPoint_d(320,240));
}

CKinect::~CKinect()
{
    if(mStarted)
        mDevice->Stop();
}

void CKinect::Start()
{
    if(!mStarted)
    {
        mDevice->Start();
        mStarted=true;
    }
}

void CKinect::Stop()
{
    if(mStarted)
    {
        mDevice->Stop();
        mStarted=false;
    }
}

std::pair<img::CImage_rgb8,img::CImage_gray32f> CKinect::GetOne()
{
    return mDevice->GetOne();
}

/*namespace cvi*/ } /*namespace buola*/ }

#endif